import random, hashlib,collections
def list_str2list(lstr):
    lstr = lstr.strip('[]')
    lst = [out.strip("''") for out in lstr.split(', ')]
    return lst

def tuple_str2list(db_str):
    db_str = db_str.strip("()")
    db_str = [out.strip("''") for out in db_str.split(', ')]
    return db_str


def hash(string):
    hash_obj = hashlib.md5()
    hash_obj.update(string.encode('utf-8'))
    return hash_obj.hexdigest()

def get_most_respose(sul,querys,max_test):
    resposes = []
    for i in range(int(max_test)):
        resposes.append(str(sul.sul.query(querys)))
    
    return list_str2list(collections.Counter(resposes).most_common(1)[0][0])